package com.xiaofeng.service.iserviceimpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaofeng.common.Const;
import com.xiaofeng.dao.idao.Human_ResourceDao;
import com.xiaofeng.pojo.Human_Resource;
import com.xiaofeng.pojo.Page;
import com.xiaofeng.service.iservice.Human_ResourceService;



@Service("human_ResourceService")
public class Human_ResourceServiceImpl implements Human_ResourceService{

	@Autowired
	Human_ResourceDao hr;
	@Override
	public String insert(Human_Resource human_Resource) {
		String msg = Const.ERROR;
		try {
			hr.insert(human_Resource);
			msg = Const.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return msg;
	}

	@Override
	public String delete(Human_Resource human_Resource){
		String msg = Const.ERROR;
		try {
			hr.delete(human_Resource);
			msg = Const.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return msg;
		
	}

	@Override
	public String update(Human_Resource human_Resource) {
		String msg = Const.ERROR;
		try {
			hr.update(human_Resource);
			msg = Const.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return msg;
		
	}

	@Override
	public Human_Resource findById(int id) {
		Human_Resource human_Resource = null;
		try {
			human_Resource = hr.findById(id);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return human_Resource;
	}

	@Override
	public List<Human_Resource> findall(int num,int size) {
		List<Human_Resource> list = null;
		try {
			list = hr.findall(num, size);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}

	@Override
	public Page<Human_Resource> findByPagno(int pageNo) {
		Page<Human_Resource> page = null;
		try {
			page = hr.findByPageNo(pageNo);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return page;
	}



	
}
